package com.pos.action;

import com.pos.pojo.Dish;
import com.pos.service.DishService;

import java.util.List;

public class DishAction {
    DishService dishService;
    List<Dish> dishes;
    Dish dish;

    public String list() {
        System.out.println("ActionList");
        dishes = dishService.list();
        return "listDish";
    }

    public String add(){
        dishService.add(dish);
        return "listDishAction";
    }
    public String edit(){
        dish = (Dish)dishService.get(dish.getDishId());
        return "editDish";
    }
    public String delete(){
        dishService.delete(dish);
        return "listDishAction";
    }
    public String update(){
        dishService.update(dish);
        return "listDishAction";
    }

    public DishService getDishService() {
        return dishService;
    }

    public void setDishService(DishService dishService) {
        this.dishService = dishService;
    }

    public List<Dish> getDishes() {
        return dishes;
    }

    public void setDishes(List<Dish> dishes) {
        this.dishes = dishes;
    }

    public Dish getDish() {
        return dish;
    }

    public void setDish(Dish dish) {
        this.dish = dish;
    }
}
